package com.xhwl.data.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.pojo.cent.sdata.Group;
import com.xhwl.common.query.cent.sdata.GroupQuery;
import com.xhwl.data.pojo.GroupQueryVO;
import com.xhwl.data.service.IGroupService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: JCccc
 * @Description:
 * @Date: Create in 15:17 2021/1/14
 */
@RestController
public class GroupController {
    private static final Logger log = LoggerFactory.getLogger(GroupController.class);
    @Autowired
    private IGroupService groupService;

    @RequestMapping(value = "/group/page")
    public ResultJson page(@RequestBody GroupQueryVO query) {
        Page<Group> result = groupService.page(query.getPage(), query.getGroupQuery());
        return ResultJson.success(result);
    }

    /**
     * 查组成员
     * @param query
     * @return
     */
    @RequestMapping(value = "/group/account/page")
    public ResultJson accPage(@RequestBody GroupQueryVO query) {
        Page<Account> result = groupService.getGroupAccPage(query.getPage(), query.getGroupQuery());
        return ResultJson.success(result);
    }
}
